<html>
<head>
<title>Synchronet JavaScript Object Model Reference</title>
<STYLE>
	OL LI                { cursor: hand; }
	UL LI                { display: none;list-style: square; }
	.showList LI         { display: list-item; }
</STYLE>
</head>
<body>
<font face=arial,helvetica>
<h1>Synchronet JavaScript Object Model Reference</h1>
Generated for <b>Synchronet v3.14a</b>, compiled Dec 27 2006 17:06
<br><font size=-1>
Includes Properties and Methods added or substantially modified in Synchronet v3.14 only.
</font>
<ol type=square>
<li onclick = 'this.className = (this.className == "showList") ? "defaultStyles" : "showList";'
	onselectstart = 'event.returnValue = false;'>
[+] &nbsp<a href="#global"><b>global</b></a> object
<ul>
<li onclick = 'this.className = (this.className == "showList") ? "defaultStyles" : "showList";'
	onselectstart = 'event.returnValue = false;'>
<a href=#global_methods>methods</a>
<li onclick = 'this.className = (this.className == "showList") ? "defaultStyles" : "showList";'
	onselectstart = 'event.returnValue = false;'>
<a href=#global_properties>properties</a>
</ul>
<li onclick = 'this.className = (this.className == "showList") ? "defaultStyles" : "showList";'
	onselectstart = 'event.returnValue = false;'>
[+] &nbsp<a href="#js"><b>js</b></a> object
<ul>
<li onclick = 'this.className = (this.className == "showList") ? "defaultStyles" : "showList";'
	onselectstart = 'event.returnValue = false;'>
<a href=#js_methods>methods</a>
<li onclick = 'this.className = (this.className == "showList") ? "defaultStyles" : "showList";'
	onselectstart = 'event.returnValue = false;'>
<a href=#js_properties>properties</a>
</ul>
<li onclick = 'this.className = (this.className == "showList") ? "defaultStyles" : "showList";'
	onselectstart = 'event.returnValue = false;'>
[+] &nbsp<a href="#system"><b>system</b></a> object
<ul>
<li onclick = 'this.className = (this.className == "showList") ? "defaultStyles" : "showList";'
	onselectstart = 'event.returnValue = false;'>
<a href=#system_methods>methods</a>
<li onclick = 'this.className = (this.className == "showList") ? "defaultStyles" : "showList";'
	onselectstart = 'event.returnValue = false;'>
<a href=#system_properties>properties</a>
</ul>
<li onclick = 'this.className = (this.className == "showList") ? "defaultStyles" : "showList";'
	onselectstart = 'event.returnValue = false;'>
[+] &nbsp<a href="#server"><b>server</b></a> object
<ul>
</ul>
<li onclick = 'this.className = (this.className == "showList") ? "defaultStyles" : "showList";'
	onselectstart = 'event.returnValue = false;'>
[+] &nbsp<a href="#client"><b>client</b></a> object
<ul>
</ul>
<li onclick = 'this.className = (this.className == "showList") ? "defaultStyles" : "showList";'
	onselectstart = 'event.returnValue = false;'>
[+] &nbsp<a href="#user"><b>user</b></a> object
<ul>
<li onclick = 'this.className = (this.className == "showList") ? "defaultStyles" : "showList";'
	onselectstart = 'event.returnValue = false;'>
<a href=#user_methods>methods</a>
<li onclick = 'this.className = (this.className == "showList") ? "defaultStyles" : "showList";'
	onselectstart = 'event.returnValue = false;'>
<a href=#user_properties>properties</a>
</ul>
<li onclick = 'this.className = (this.className == "showList") ? "defaultStyles" : "showList";'
	onselectstart = 'event.returnValue = false;'>
[+] &nbsp<a href="#bbs"><b>bbs</b></a> object
<ul>
<li onclick = 'this.className = (this.className == "showList") ? "defaultStyles" : "showList";'
	onselectstart = 'event.returnValue = false;'>
<a href=#bbs_methods>methods</a>
<li onclick = 'this.className = (this.className == "showList") ? "defaultStyles" : "showList";'
	onselectstart = 'event.returnValue = false;'>
<a href=#bbs_properties>properties</a>
</ul>
<li onclick = 'this.className = (this.className == "showList") ? "defaultStyles" : "showList";'
	onselectstart = 'event.returnValue = false;'>
[+] &nbsp<a href="#console"><b>console</b></a> object
<ul>
<li onclick = 'this.className = (this.className == "showList") ? "defaultStyles" : "showList";'
	onselectstart = 'event.returnValue = false;'>
<a href=#console_methods>methods</a>
</ul>
<li onclick = 'this.className = (this.className == "showList") ? "defaultStyles" : "showList";'
	onselectstart = 'event.returnValue = false;'>
[+] &nbsp<a href="#msg_area"><b>msg_area</b></a> object
<ul>
</ul>
<li onclick = 'this.className = (this.className == "showList") ? "defaultStyles" : "showList";'
	onselectstart = 'event.returnValue = false;'>
[+] &nbsp<a href="#file_area"><b>file_area</b></a> object
<ul>
</ul>
<li onclick = 'this.className = (this.className == "showList") ? "defaultStyles" : "showList";'
	onselectstart = 'event.returnValue = false;'>
[+] &nbsp<a href="#xtrn_area"><b>xtrn_area</b></a> object
<ul>
</ul>
<li onclick = 'this.className = (this.className == "showList") ? "defaultStyles" : "showList";'
	onselectstart = 'event.returnValue = false;'>
[+] &nbsp<a href="#MsgBase"><b>MsgBase</b></a> class
<ul>
<li onclick = 'this.className = (this.className == "showList") ? "defaultStyles" : "showList";'
	onselectstart = 'event.returnValue = false;'>
<a href=#MsgBase_methods>methods</a>
</ul>
<li onclick = 'this.className = (this.className == "showList") ? "defaultStyles" : "showList";'
	onselectstart = 'event.returnValue = false;'>
[+] &nbsp<a href="#File"><b>File</b></a> class
<ul>
<li onclick = 'this.className = (this.className == "showList") ? "defaultStyles" : "showList";'
	onselectstart = 'event.returnValue = false;'>
<a href=#File_methods>methods</a>
</ul>
<li onclick = 'this.className = (this.className == "showList") ? "defaultStyles" : "showList";'
	onselectstart = 'event.returnValue = false;'>
[+] &nbsp<a href="#Queue"><b>Queue</b></a> class
<ul>
<li onclick = 'this.className = (this.className == "showList") ? "defaultStyles" : "showList";'
	onselectstart = 'event.returnValue = false;'>
<a href=#Queue_methods>methods</a>
</ul>
<li onclick = 'this.className = (this.className == "showList") ? "defaultStyles" : "showList";'
	onselectstart = 'event.returnValue = false;'>
[+] &nbsp<a href="#Socket"><b>Socket</b></a> class
<ul>
<li onclick = 'this.className = (this.className == "showList") ? "defaultStyles" : "showList";'
	onselectstart = 'event.returnValue = false;'>
<a href=#Socket_methods>methods</a>
</ul>
</ol>
<h2><a name=global>global object</a>
<br><font size=-1>Top-level functions and properties (common to all servers and services)</font>
</h2>
<table border=1 width=100%>
<caption align=left><b><tt>global</tt>
<a name=global_methods> methods</a>
</b></caption>
<tr bgcolor=gray>
<th align=left width=100>
<font color="white">Name</font>
<th align=left width=100>
<font color="white">Returns</font>
<th align=left width=200>
<font color="white">Usage</font>
<th align=left>
<font color="white">Description</font>
<tr valign=top><td><b>write_raw</b><td>void<td><tt>write_raw(value [,value])
<td>send a stream of bytes (possibly containing NULLs or special control code sequences) to the server output
<tr valign=top><td><b>wildmatch</b><td>boolean<td><tt>wildmatch([case_sensitive=<tt>false</tt>,] string [,pattern=<tt>'*'</tt>] [,path=<tt>false</tt>])
<td>returns <tt>true</tt> if the <i>string</i> matches the wildcard <i>pattern</i> (wildcards supported are '*' and '?'), if <i>path</i> is <tt>true</tt>, '*' will not match path delimeter characters (e.g. '/')
<tr valign=top><td><b>file_removecase</b><td>boolean<td><tt>file_removecase(path/filename)
<td>delete files case insensitively
<tr valign=top><td><b>file_compare</b><td>boolean<td><tt>file_compare(path/file1, path/file2)
<td>compare 2 files, returning <i>true</i> if they are identical, <i>false</i> otherwise
<tr valign=top><td><b>disk_size</b><td>number<td><tt>disk_size(directory [,unit_size=<tt>1</tt>])
<td>returns the total disk size of the specified <i>directory</i> using the specified <i>unit_size</i> in bytes (default: 1), specify a <i>unit_size</i> of <tt>1024</tt> to return the total disk size in <i>kilobytes</i>.
</table>
<br>
<table border=1 width=100%>
<caption align=left><b><tt>global</tt>
<a name=global_properties> properties</a>
</b></caption>
<tr bgcolor=gray>
<th align=left width=100>
<font color="white">Name</font>
<th align=left width=100>
<font color="white">Type</font>
<th align=left>
<font color="white">Description</font>
<tr><td><b>argc</b><td>number<td>number of arguments passed to the script</td>
<tr><td><b>argv</b><td>array<td>array of argument strings (argv.length == argc)</td>
<tr><td><b>errno</b><td>number<td>last system error number</td>
<tr><td><b>errno_str</b><td>string<td>description of last system error</td>
<tr><td><b>socket_errno</b><td>number<td>last socket-related error number (same as <i>errno</i> on Unix platforms)</td>
</table>
<h2><a name=js>js object</a>
<br><font size=-1>JavaScript execution and garbage collection control object</font>
</h2>
<table border=1 width=100%>
<caption align=left><b><tt>js</tt>
<a name=js_methods> methods</a>
</b></caption>
<tr bgcolor=gray>
<th align=left width=100>
<font color="white">Name</font>
<th align=left width=100>
<font color="white">Returns</font>
<th align=left width=200>
<font color="white">Usage</font>
<th align=left>
<font color="white">Description</font>
<tr valign=top><td><b>get_parent</b><td>object<td><tt>js.get_parent(object)
<td>return the parent of the specified object
</table>
<br>
<table border=1 width=100%>
<caption align=left><b><tt>js</tt>
<a name=js_properties> properties</a>
</b></caption>
<tr bgcolor=gray>
<th align=left width=100>
<font color="white">Name</font>
<th align=left width=100>
<font color="white">Type</font>
<th align=left>
<font color="white">Description</font>
<tr valign=top><td><b>global</b><td>object
<td>global (top level) object - <small>READ ONLY</small>
</table>
<h2><a name=system>system object</a>
<br><font size=-1>Global system-related properties and methods</font>
</h2>
<table border=1 width=100%>
<caption align=left><b><tt>system</tt>
<a name=system_methods> methods</a>
</b></caption>
<tr bgcolor=gray>
<th align=left width=100>
<font color="white">Name</font>
<th align=left width=100>
<font color="white">Returns</font>
<th align=left width=200>
<font color="white">Usage</font>
<th align=left>
<font color="white">Description</font>
</table>
<br>
<table border=1 width=100%>
<caption align=left><b><tt>system</tt>
<a name=system_properties> properties</a>
</b></caption>
<tr bgcolor=gray>
<th align=left width=100>
<font color="white">Name</font>
<th align=left width=100>
<font color="white">Type</font>
<th align=left>
<font color="white">Description</font>
<tr valign=top><td><b>cmd_shell</b><td>string
<td>platform-specific command processor/shell
<tr valign=top><td><b>timer</b><td>number
<td>high-resolution timer, in seconds (fractional seconds supported)
</table>
<h2><a name=server>server object</a>
<br><font size=-1>Server-specifc properties</font>
</h2>
<h2><a name=client>client object</a>
<br><font size=-1>Represents a TCP/IP client session</font>
</h2>
<h2><a name=user>user object</a>
<br><font size=-1>Instance of <i>User</i> class, representing current user online</font>
</h2>
<p>To create a new user object: <tt>var u = new User(<i>number</i>)</tt></p>
<table border=1 width=100%>
<caption align=left><b><tt>user</tt>
<a name=user_methods> methods</a>
</b></caption>
<tr bgcolor=gray>
<th align=left width=100>
<font color="white">Name</font>
<th align=left width=100>
<font color="white">Returns</font>
<th align=left width=200>
<font color="white">Usage</font>
<th align=left>
<font color="white">Description</font>
<tr valign=top><td><b>adjust_credits</b><td>boolean<td><tt>user.adjust_credits(count)
<td>Adjust user's credits by <i>count</i> (negative to subtract)
<tr valign=top><td><b>adjust_minutes</b><td>boolean<td><tt>user.adjust_minutes(count)
<td>Adjust user's extra minutes <i>count</i> (negative to subtract)
<tr valign=top><td><b>posted_message</b><td>boolean<td><tt>user.posted_message([count])
<td>Adjust user's posted-messages statistics by <i>count</i> (default: 1) (negative to subtract)
<tr valign=top><td><b>sent_email</b><td>boolean<td><tt>user.sent_email([count] [,bool feedback])
<td>Adjust user's email/feedback-sent statistics by <i>count</i> (default: 1) (negative to subtract)
<tr valign=top><td><b>uploaded_file</b><td>boolean<td><tt>user.uploaded_file([bytes] [,files])
<td>Adjust user's files/bytes-uploaded statistics
<tr valign=top><td><b>downloaded_file</b><td>boolean<td><tt>user.downloaded_file([bytes] [,files])
<td>Adjust user's files/bytes-downloaded statistics
</table>
<br>
<table border=1 width=100%>
<caption align=left><b><tt>user</tt>
<a name=user_properties> properties</a>
</b></caption>
<tr bgcolor=gray>
<th align=left width=100>
<font color="white">Name</font>
<th align=left width=100>
<font color="white">Type</font>
<th align=left>
<font color="white">Description</font>
<tr valign=top><td><b>cached</b><td>boolean
<td>record is currently cached in memory
</table>
<h2><a name=bbs>bbs object</a>
<br><font size=-1>Controls the Telnet/RLogin BBS experience</font>
</h2>
<table border=1 width=100%>
<caption align=left><b><tt>bbs</tt>
<a name=bbs_methods> methods</a>
</b></caption>
<tr bgcolor=gray>
<th align=left width=100>
<font color="white">Name</font>
<th align=left width=100>
<font color="white">Returns</font>
<th align=left width=200>
<font color="white">Usage</font>
<th align=left>
<font color="white">Description</font>
<tr valign=top><td><b>send_file</b><td>boolean<td><tt>bbs.send_file(filename [,protocol])
<td>send specified filename (complete path) to user via user-prompted (or optionally specified) protocol
<tr valign=top><td><b>receive_file</b><td>boolean<td><tt>bbs.receive_file(filename [,protocol])
<td>received specified filename (complete path) frome user via user-prompted (or optionally specified) protocol
<tr valign=top><td><b>list_msgs</b><td>number<td><tt>bbs.list_msgs([sub-board=<i>current</i>] [,mode=<tt>SCAN_READ</tt>] [,message_number=<tt>0</tt>] [,string find])
<td>list messages in the specified message sub-board (number or internal code), optionally search for 'find' string, returns number of messages listed
</table>
<br>
<table border=1 width=100%>
<caption align=left><b><tt>bbs</tt>
<a name=bbs_properties> properties</a>
</b></caption>
<tr bgcolor=gray>
<th align=left width=100>
<font color="white">Name</font>
<th align=left width=100>
<font color="white">Type</font>
<th align=left>
<font color="white">Description</font>
<tr valign=top><td><b>start_time</b><td>number
<td>time from which user's time left is calculated, in <i>time_t</i> format
<tr valign=top><td><b>cursub_code</b><td>string
<td>current message sub-board internal code
<tr valign=top><td><b>curdir_code</b><td>string
<td>current file directory internal code
<tr valign=top><td><b>command_str</b><td>string
<td>current command shell/module <i>command string</i> value
</table>
<h2><a name=console>console object</a>
<br><font size=-1>Controls the user's Telnet/RLogin terminal</font>
</h2>
<table border=1 width=100%>
<caption align=left><b><tt>console</tt>
<a name=console_methods> methods</a>
</b></caption>
<tr bgcolor=gray>
<th align=left width=100>
<font color="white">Name</font>
<th align=left width=100>
<font color="white">Returns</font>
<th align=left width=200>
<font color="white">Usage</font>
<th align=left>
<font color="white">Description</font>
<tr valign=top><td><b>term_supports</b><td>boolean<td><tt>console.term_supports([terminal_flags])
<td>either returns <i>bool</i>, indicating whether or not the current user/client supports all the specified <i>terminal_flags</i>, or returns the current user/client's <i>terminal_flags</i> (numeric bit-field) if no <i>terminal_flags</i> were specified
</table>
<h2><a name=msg_area>msg_area object</a>
<br><font size=-1>Message Areas</font>
</h2>
<h2><a name=file_area>file_area object</a>
<br><font size=-1>File Transfer Areas</font>
</h2>
<h2><a name=xtrn_area>xtrn_area object</a>
<br><font size=-1>External Program Areas</font>
</h2>
<h2><a name=MsgBase>MsgBase class</a>
<br><font size=-1>Class used for accessing message bases</font>
</h2>
<p>To create a new MsgBase object: <tt>var msgbase = new MsgBase('<i>code</i>')</tt><br>where <i>code</i> is a sub-board internal code, or <tt>mail</tt> for the e-mail message base</p>
<table border=1 width=100%>
<caption align=left><b><tt>MsgBase</tt>
<a name=MsgBase_methods> methods</a>
</b></caption>
<tr bgcolor=gray>
<th align=left width=100>
<font color="white">Name</font>
<th align=left width=100>
<font color="white">Returns</font>
<th align=left width=200>
<font color="white">Usage</font>
<th align=left>
<font color="white">Description</font>
</table>
<h2><a name=File>File class</a>
<br><font size=-1>Class used for opening, creating, reading, or writing files on the local file system<p>Special features include:</h2><ol type=disc><li>Exclusive-access files (default) or shared files<ol type=circle><li>optional record-locking<li>buffered or non-buffered I/O</ol><li>Support for binary files<ol type=circle><li>native or network byte order (endian)<li>automatic Unix-to-Unix (<i>UUE</i>), yEncode (<i>yEnc</i>) or Base64 encoding/decoding</ol><li>Support for ASCII text files<ol type=circle><li>supports line-based I/O<ol type=square><li>entire file may be read or written as an array of strings<li>individual lines may be read or written one line at a time</ol><li>supports fixed-length records<ol type=square><li>optional end-of-text (<i>etx</i>) character for automatic record padding/termination<li>Synchronet <tt>.dat</tt> files use an <i>etx</i> value of 3 (Ctrl-C)</ol><li>supports <tt>.ini</tt> formated configuration files<ol type=square><li>concept and support of <i>root</i> ini sections added in v3.12</ol><li>optional ROT13 encoding/translation</ol><li>Dynamically-calculated industry standard checksums (e.g. CRC-16, CRC-32, MD5)</ol></font>
</h2>
<p>To create a new File object: <tt>var f = new File(<i>filename</i>)</tt></p>
<table border=1 width=100%>
<caption align=left><b><tt>File</tt>
<a name=File_methods> methods</a>
</b></caption>
<tr bgcolor=gray>
<th align=left width=100>
<font color="white">Name</font>
<th align=left width=100>
<font color="white">Returns</font>
<th align=left width=200>
<font color="white">Usage</font>
<th align=left>
<font color="white">Description</font>
<tr valign=top><td><b>truncate</b><td>boolean<td><tt>File.truncate([length=<tt>0</tt>])
<td>changes the file <i>length</i> (default: 0) and repositions the file pointer (<i>position</i>) to the new end-of-file
<tr valign=top><td><b>iniRemoveKey</b><td>boolean<td><tt>File.iniRemoveKey(section, key)
<td>remove specified <i>key</i> from specified <i>section</i> in <tt>.ini</tt> file.
<tr valign=top><td><b>iniRemoveSection</b><td>boolean<td><tt>File.iniRemoveSection(section)
<td>remove specified <i>section</i> from <tt>.ini</tt> file.
</table>
<h2><a name=Queue>Queue class</a>
<br><font size=-1>Class for bi-directional message queues. Used for inter-thread/module communications.</font>
</h2>
<p>To create a new (named) Queue object: <tt>var q = new Queue(<i>name</i>)</tt></p>
<table border=1 width=100%>
<caption align=left><b><tt>Queue</tt>
<a name=Queue_methods> methods</a>
</b></caption>
<tr bgcolor=gray>
<th align=left width=100>
<font color="white">Name</font>
<th align=left width=100>
<font color="white">Returns</font>
<th align=left width=200>
<font color="white">Usage</font>
<th align=left>
<font color="white">Description</font>
</table>
<h2><a name=Socket>Socket class</a>
<br><font size=-1>Class used for TCP/IP socket communications</font>
</h2>
<p>To create a new Socket object: <tt>load('sockdefs.js'); var s = new Socket(<i>type</i>, <i>protocol</i>)</tt><br>where <i>type</i> = <tt>SOCK_STREAM</tt> for TCP (default) or <tt>SOCK_DGRAM</tt> for UDP<br>and <i>protocol</i> (optional) = the name of the protocol or service the socket is to be used for</p>
<table border=1 width=100%>
<caption align=left><b><tt>Socket</tt>
<a name=Socket_methods> methods</a>
</b></caption>
<tr bgcolor=gray>
<th align=left width=100>
<font color="white">Name</font>
<th align=left width=100>
<font color="white">Returns</font>
<th align=left width=200>
<font color="white">Usage</font>
<th align=left>
<font color="white">Description</font>
</table>
<p><small>
Totals: 8 properties, 19 methods
